package com.starlz.jpa.controller;

import com.starlz.jpa.entity.Emp;
import com.starlz.jpa.entity.LocalUser;
import com.starlz.jpa.service.EmpService;
import com.starlz.jpa.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description:
 * @Author: wangzi
 * @Date: 2018/11/20 10:41
 */
@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    UserService userService;

    @RequestMapping("findAll")
    public List<LocalUser> findAll(){

        Page<LocalUser> page = userService.findAll();
        return page.getContent();
    }

    @RequestMapping("save")
    LocalUser sava(LocalUser user){

        return userService.sava(user);

    }
}
